from flask_restful import Api
from .user_service import UserRegisterService, UserProfileService, UserLogService, UserApplicationService
from .mission_service import MissionService, MissionApplicationService, MissionsService, AppliedMissionsService
from .application_service import ApplicationService, ApplicationAcceptService, ApplicationDeclineService, \
    ApplicationCompleteService
from .file_service import FileService
from .tag_service import TagService

api = Api()


def init_app(app):
    api.add_resource(UserRegisterService, '/api/auth/register')
    api.add_resource(UserLogService, '/api/auth/login', '/api/auth/logout')
    api.add_resource(UserProfileService, '/api/profile')
    api.add_resource(MissionService, '/api/mission/<int:mission_id>')
    api.add_resource(MissionsService, '/api/missions')
    api.add_resource(AppliedMissionsService, '/api/applied_missions')
    api.add_resource(ApplicationService, '/api/mission/<int:mission_id>/application',
                     '/api/application/<int:app_id>')
    api.add_resource(MissionApplicationService,
                     '/api/mission/<int:mission_id>/applications')
    api.add_resource(ApplicationAcceptService,
                     '/api/application/<int:app_id>/accept')
    api.add_resource(ApplicationDeclineService,
                     '/api/application/<int:app_id>/decline')
    api.add_resource(ApplicationCompleteService,
                     '/api/application/<int:app_id>/complete')
    api.add_resource(FileService, '/api/file')
    api.add_resource(TagService, '/api/tags')
    api.add_resource(UserApplicationService,
                     '/api/user/<int:mission_id>/application')
    api.init_app(app)
